package com.secondGroup.mapper;

import com.secondGroup.entity.BankCard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.secondGroup.entity.VirtualBankCard;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ybk
 * @since 2022-05-05
 */
@Mapper
public interface BankCardMapper extends BaseMapper<BankCard> {

    @Insert("insert into t_bank_card (account,c_id) values(#{account},#{cid})")
    @Results({
            @Result(column = "account",property = "account"),
            @Result(column = "c_id",property = "cid")
    })
    void insert(String account, String cid);


    @Select("select id from t_bank_card where c_id =#{cid}")
    @Results({
            @Result(column = "c_id",property = "cid")
    })
    BankCard find(String cid);

    List<VirtualBankCard> getBankCardByAccount(String account);

    @Select("SELECT c_id FROM t_bank_card WHERE account = #{account}")
    String selectCid(String account);
    @Select("SELECT c_id,account FROM t_bank_card WHERE account = #{account}")
    List<BankCard> queryBankCard(String account);

}
